CarPhysics Class Reference

#include <CarPhysics.h>

Inheritance diagram for CarPhysics:

PhysicsClient List of all members.

Public Member Functions

 CarPhysics (Vehicle &vehicle)
virtual ~CarPhysics ()
virtual double update (double step)
virtual void odeDraw ()
bool create (const CarData *carDataPtr, osg::ref_ptr< osg::PositionAttitudeTransform > objectPAT)
void setSteering (double steer)
void setAccelleration (double acl)
void setGear (int gear)
double getSpeed ()
double getTraction ()
const Vector3 & getPosition ()
const double * getRotation ()
void setPosition (double x, double y, double z)
void setRotation (double x, double y, double z)
void mySetPosition ()
Vehicle * getOSGVehicle ()

Protected Member Functions

void positionCar (double x, double y, double z)
const double * getGeomPosition (dGeomID geom)
const double * getGeomRotation (dGeomID geom)
void addGeom (dGeomID geom, dReal xoff, dReal yoff, dReal zoff, dMatrix3 R)

Protected Attributes

const CarData * _pCarData
double _steering
double _accel
double _speed
double _traction
double _chassisHgt
double _gearMod
dBodyID _carBody
dBodyID _wheelBody [4]
dJointID _joint [4]
dSpaceID _carSpace
vector< dGeomID > _carGeoms
dGeomID _wheelGeom [4]
PhysGeomData _wheelData
Vehicle OSGvehicle

Detailed Description

CarPhysics.h: interface for the CarPhysics class.


Constructor & Destructor Documentation

CarPhysics::CarPhysics (  Vehicle &  vehicle  ) 
 

A constructor with one argument.

Parameters:
vehicle a Vehicle refrence.

virtual CarPhysics::~CarPhysics (   )  [virtual]
 

A destructor.


Member Function Documentation

void CarPhysics::addGeom (  dGeomID  geom,
dReal  xoff,
dReal  yoff,
dReal  zoff,
dMatrix3  R
)  [protected]
 

bool CarPhysics::create (  const CarData *  carDataPtr,
osg::ref_ptr< osg::PositionAttitudeTransform >  objectPAT
) 
 

a normal member taking two arguments and returning a bool.

Parameters:
carDataPtr a pointer to CarData.
objectPAT a osg::ref_ptr to osg::PositionAttitudeTransform.
Returns:
true if successful set car parameters and create all bodies and geometries

const double* CarPhysics::getGeomPosition (  dGeomID  geom  )  [protected]
 

a protected member taking one arguments and returning const double *.

Parameters:
geom a dGeomID argument.
Returns:
const double*. returns position for a specific geom.

const double* CarPhysics::getGeomRotation (  dGeomID  geom  )  [protected]
 

Vehicle* CarPhysics::getOSGVehicle (   ) 
 

const Vector3& CarPhysics::getPosition (   ) 
 

const double* CarPhysics::getRotation (   ) 
 

double CarPhysics::getSpeed (   ) 
 

double CarPhysics::getTraction (   )  [inline]
 

void CarPhysics::mySetPosition (   ) 
 

virtual void CarPhysics::odeDraw (   )  [virtual]
 

A virtual member. updates simulation state.

Implements PhysicsClient.

void CarPhysics::positionCar (  double  x,
double  y,
double  z
)  [protected]
 

a protected member taking three arguments and returning void.

Parameters:
x a double argument for x coordinate of the car.
y a double argument for y coordinate of the car.
z a double argument for z coordinate of the car. position entire car (global world coordinates)

void CarPhysics::setAccelleration (  double  acl  )  [inline]
 

void CarPhysics::setGear (  int  gear  ) 
 

void CarPhysics::setPosition (  double  x,
double  y,
double  z
) 
 

void CarPhysics::setRotation (  double  x,
double  y,
double  z
) 
 

void CarPhysics::setSteering (  double  steer  )  [inline]
 

virtual double CarPhysics::update (  double  step  )  [virtual]
 

A virtual member.

Parameters:
step double step size.

Implements PhysicsClient.


Member Data Documentation

double CarPhysics::_accel [protected]
 

a protected variable. current acceleration.

dBodyID CarPhysics::_carBody [protected]
 

a protected variable. body id of vehicle.

vector<dGeomID> CarPhysics::_carGeoms [protected]
 

a protected variable. vector for car geometries (actually dGeomTransforms).

dSpaceID CarPhysics::_carSpace [protected]
 

a protected variable. space for car geometries.

double CarPhysics::_chassisHgt [protected]
 

a protected variable. height of chassis.

double CarPhysics::_gearMod [protected]
 

a protected variable. gear modifier, used for gear switching (transmission).

dJointID CarPhysics::_joint[4] [protected]
 

a protected variable. joint ids of vehicle wheels.

const CarData* CarPhysics::_pCarData [protected]
 

a protected variable. struct for car attributes.

double CarPhysics::_speed [protected]
 

a protected variable. current car speed.

double CarPhysics::_steering [protected]
 

a protected variable. current steering (-1=left 1=right).

double CarPhysics::_traction [protected]
 

dBodyID CarPhysics::_wheelBody[4] [protected]
 

a protected variable. body ids of vehicle wheels.

PhysGeomData CarPhysics::_wheelData [protected]
 

dGeomID CarPhysics::_wheelGeom[4] [protected]
 

a protected variable. geom for each wheel.

Vehicle CarPhysics::OSGvehicle [protected]
 


The documentation for this class was generated from the following file:
Generated on Sun May 28 18:44:00 2006 by  doxygen 1.4.6-NO